﻿using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Memory;
using Elsa.Workflows.UIHints;

namespace T.FAS.Runtime.MF.SPI
{
    public abstract class FASCodeActivity<T> : CodeActivity<object?>, IActivityWithExceptionHandle
    {
        /// <summary>
        /// 正常执行的输出端口
        /// </summary>
        public List<string> DoneOutcomes { get; set; }
        /// <summary>
        /// 异常执行的输出端口
        /// </summary>

        public List<string> ExceptionOutcomes { get; set; }

        /// <summary>
        /// 当节点发生异常时，给每个变量赋的默认值
        /// </summary>
        public Dictionary<string, object> DefaultValuesWhenException { get; set; }

        public virtual List<Variable> ActivityOutputVariables { get { return new List<Variable>(); } }

        [Elsa.Workflows.Attributes.Input(
      Description = "失败策略", Options = new[] { "返回默认值", "节点停止运行", "终止整个工作流", "异常分支" }, UIHint = InputUIHints.DropDown, Order = 2)]
        public string FaultedStrategy { get; set; } = "终止整个工作流";

        [Input(Description = "节点运行出参的实时数据")]
        public Dictionary<string, object> OutputInstanceValues { get; set; } = new Dictionary<string, object>();
        [Input(Description = "节点运行入参的实时数据")]
        public Dictionary<string, object> InputInstanceValues { get; set; } = new Dictionary<string, object>();

    }
}
